package cn.hhy.hrm.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Document(indexName = "course" , type = "_doc")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CourseDoc {


    @Id
    private Long id;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")    //指定为 不分词
    private String name;

    @Field(type = FieldType.Keyword)
    private String gradeName;


    /**
     * 课程等级
     */
    @Field(type = FieldType.Long)
    private Long grade;
    /**
     * 教育机构
     */
    @Field(type = FieldType.Long)
    private Long tenantId;

    @Field(type = FieldType.Keyword)
    private String tenantName;

    @Field(type = FieldType.Date)
    private Date startTime;
    @Field(type = FieldType.Date)
    private Date endTime;
    @Field(type = FieldType.Keyword)
    private String pic;
    /**
     * 收费规则，对应数据字典,免费，收费
     */
    @Field(type = FieldType.Long)
    private Long charge;
    /**
     * 原价
     */
    @Field(type = FieldType.Float)
    private Float priceOld;
    /**
     * 分类
     */
    @Field(type = FieldType.Long)
    private Long courseTypeId;
    /**
     * 价格
     */
    @Field(type = FieldType.Float)
    private float price;
    /**
     * 简介
     */
    @Field(type =FieldType.Keyword)
    private String description;

    //排序条件
    //上线时间
    @Field(type = FieldType.Date)
    private Date onlineTime = new Date();
    //销量
    @Field(type = FieldType.Integer)
    private int saleCount = 0;
    //评论数
    @Field(type = FieldType.Integer)
    private int commentCount = 0;
    @Field(type = FieldType.Integer)
    private int viewCount = 0;

}